package io.renren.modules.bus.service.impl;

import io.renren.modules.bus.entity.PointRuleEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.modules.bus.dao.StoreDao;
import io.renren.modules.bus.entity.StoreEntity;
import io.renren.modules.bus.service.StoreService;


@Service("storeService")
public class StoreServiceImpl extends ServiceImpl<StoreDao, StoreEntity>
        implements StoreService {

    @Autowired
    private StoreDao dao;

    /**
     * 单表分页查询
     */
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<StoreEntity> page = this.selectPage(
                new Query<StoreEntity>(params).getPage(),
                new EntityWrapper<StoreEntity>()
        );
        return new PageUtils(page);
    }

    /**
     * 分页查询
     */
    @Override
    public PageUtils list4Page(Map<String, Object> params){
        Page<StoreEntity> page = new Query<StoreEntity>(params).getPage();
        return new PageUtils(page.setRecords(dao.list4Page(page, params)));
    }

    /**
     * 条件查询
     */
    public List<StoreEntity> listByCondition(Map<String, Object> params) {
        return dao.listByCondition(params);
    }

    /**
     * 逻辑删除多条记录
     */
    public Boolean deleteLogic(List ids) {
        return dao.deleteLogic(ids);
    }

    /**
     * 根据id查询详情
     */
    @Override
    public StoreEntity queryOneById(Integer id) {
        return dao.queryOneById(id);
    }
}
